#ifndef BODY_TYPE_H__
#define BODY_TYPE_H__



class BodyType
{
private:
    bool active;
    int special_type;
    int player_id;
    
public:

    typedef enum {
        SP_NONE,
        SP_BALL,
        SP_TELEPORT,
        SP_GOAL,
        SP_MOVING_OBJECT,
        SP_PICKUP,
        SP_SCORE_OBJECT,
        SP_SCORE_GOAL,
        SP_SCORE_TOPPLE
    } SpecialType;

    BodyType();
    BodyType(int bt);
    
    bool isActive();
    unsigned getSpecialType();
    unsigned getPlayerID();
    
    void setActive(bool ac);
    void setSpecialType(int so_type);
    void setPlayerID(int p_id);
    
    int getValue();
    
};

inline 
BodyType::BodyType()
{
    active = false;
    special_type = 0;
    player_id = 0;
}

inline
BodyType::BodyType(int bt)
{
    active = bt & 0x1;
    special_type = (bt >> 1) & 0xF;
    player_id = (bt >> 5) & 0x7FFFFFF;
}

inline
int BodyType::getValue()
{
    int val = 0;
    if (active)
        val |= 0x1;
    val |= (special_type & 0xF) << 1;
    val |= (player_id & 0x7FFFFFF) << 5;
    return val;
}

inline
bool BodyType::isActive()
{
    return active;
}

inline
unsigned BodyType::getSpecialType()
{
    return special_type;
}

inline
unsigned BodyType::getPlayerID()
{
    return player_id;
}

inline
void BodyType::setActive(bool ac)
{
    active = ac;
}

inline
void BodyType::setSpecialType(int sp)
{
    special_type = sp;
}

inline
void BodyType::setPlayerID(int p_id)
{
    player_id = p_id;
}


#endif
